/**
 * 多行文本框
 *
 * @Author: Shann
 * @LastEditors: Shann
 * @Date: 2021-07-26 08:53:33
 * @LastEditTime: 2021-08-06 15:17:30
 * @Copyright: Copyright 2021-2021, all rights reserved. Essa.cn
 */
class Textarea {
    props = {
        context: Object,
        showCount: Boolean,
        maxLength: Number,
        placeholder: String,
        onChange: Function,
        value: String,
    };

    state = {
        value: this.props.value,
        count: 0,
        maxLength: this.props.maxLength || "off",
    };

    handleKeyup(event) {
        if (this.state.maxLength === "off") {
            return;
        }
        let target = event.target;
        this.state.count = target.value.length;
    }

    handleChange() {
        this.props.onChange(this.state.value, this.props.context);
    }
}
